// import Print from './print';
import _ from 'lodash';
// import '../style.css';
import image1 from '../assets/1.png'
import menu from '../assets/menu.svg'
import Data from '../assets/data.xml';
import Notes from '../assets/data.csv';

import toml from '../assets/data.toml';
import yaml from '../assets/data.yaml';
import json from '../assets/data.json5';

import exampleText from '../example.txt';

console.log('toml', toml);
console.log('yaml', yaml);
console.log('json', json);

function component() {
    const element = document.createElement('div');

    // lodash 是由当前 script 脚本 import 进来的
    element.innerHTML = _.join(['Hello', 'webpack'], ' ');
    // element.onclick = Print.bind(null, 'Hello webpack!');
    element.classList.add('hello');

    // 将图像添加到我们已经存在的 div 中。
    const myIcon = new Image();
    myIcon.src = image1;
    myIcon.width = '200';
    myIcon.height = '200';

    const myIcon2 = new Image();
    myIcon2.src = menu;
    myIcon2.width = '200';
    myIcon2.height = '200';
    element.appendChild(myIcon);
    element.appendChild(myIcon2);

    const elementH1 = document.createElement('h1');
    elementH1.textContent = exampleText
    element.appendChild(elementH1);

    console.log(Data);
    console.log(Notes);

    const printSvg = new URL('../assets/print.svg', import.meta.url)
    console.log(printSvg);

    return element;
}

document.body.appendChild(component());

// import numRef from './ref.json';

// export function numToWord(num) {
//     return _.reduce(
//         numRef,
//         (accum, ref) => {
//             return ref.num === num ? ref.word : accum;
//         },
//         ''
//     );
// }

// export function wordToNum(word) {
//     return _.reduce(
//         numRef,
//         (accum, ref) => {
//             return ref.word === word && word.toLowerCase() ? ref.num : accum;
//         }, -1
//     );
// }